package com.iofiledDemo;

import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class A4 {

    public static void main(String[] args) {

        File file = new File("D:/Hello.txt");
        try {
            file.createNewFile();
            FileWriter writer = new FileWriter(file);
            writer.write("This\n is \n an \n example\n");
            writer.flush();
            writer.close();

            FileReader fr = new FileReader(file);
            char[] a = new char[50];
            fr.read(a);
            for(char c : a){
                System.out.println(c);
                fr.close();

            }
        } catch (IOException e) {
            e.printStackTrace();
        }


    }











}
